<template>
	<view class="settle-container">
		<!--  全选 -->
		<view class="left-box">
			<label class="radio" @click="changeChecked">
				<radio color="#C00000" :checked="isCheckedAll" /><text>全选</text>
			</label>
		</view>
		<!-- 合计 -->
		<view class="middle-box">
			合计:&nbsp;<text>￥{{checkedAmount}}</text>
		</view>
		<!-- 结算 -->
		<view class="right-box">
			结算(<text>{{checkedCount}}</text>)
		</view>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapMutations
	} from "vuex"
	export default {
		name: "my-settle",
		data() {
			return {

			};
		},
		computed: {
			...mapGetters("cartAbout", ["checkedCount", "total", "checkedAmount"]),
			isCheckedAll() {
				// vuex中购物车商品总量和选中商品总量比较
				return this.total === this.checkedCount
			}
		},
		methods: {
			...mapMutations("cartAbout", ["updateAllChecked"]),
			changeChecked() {
				this.updateAllChecked(!this.isCheckedAll);
			}
		},
	}
</script>

<style lang="scss">
	.settle-container {
		height: 50px;
		width: 100%;
		position: fixed;
		bottom: 50px;
		left: 0;
		background-color: white;
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding-left: 5px;
		font-size: 14px;

		.left-box {
			display: flex;
			align-items: center;
		}

		.middle-box {
			text {
				color: #C00000;
				font-weight: bolder;
			}
		}

		.right-box {
			color: white;
			background-color: #C00000;
			height: 50px;
			line-height: 50px;
			min-width: 100px;
			margin-right: 10px;
			text-align: center;
		}
	}
</style>